#ifndef MYIODEVICE_H
#define MYIODEVICE_H

#include <QFile>
#include <QIODevice>

class MyIODevice : public QIODevice
{
    Q_OBJECT
public:
    MyIODevice(QObject *parent = nullptr);
    ~MyIODevice();
    void start();
    void stop();
    qint64 readData(char *data, qint64 maxSize) override;
    qint64 writeData(const char *data, qint64 maxSize) override;
    qint64 bytesAvailable() const override;
    void computeAudioData(char *data, qint64 bytesRead);

private:
    bool openFile();

private:
    QFile inputFile;
    bool emitSign;
    mutable uint8_t zeroCount;
protected slots:
};

#endif // MYIODEVICE_H
